home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form VidLib
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Video Library"
- ClientHeight = 3000
- ClientLeft = 2775
- ClientTop = 1770
- ClientWidth = 3345
- Height = 3690
- HelpContextID = 1
- Icon = VIDLIB.FRX:0000
- KeyPreview = -1 'True
- Left = 2715
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 3000
- ScaleWidth = 3345
- Top = 1140
- Width = 3465
- Begin PictureBox rptPrint
- Height = 480
- Left = 2925
- ScaleHeight = 450
- ScaleWidth = 1170
- TabIndex = 7
- Top = 0
- Width = 1200
- End
- Begin PictureBox dlgOpen
- Height = 480
- Left = 0
- ScaleHeight = 450
- ScaleWidth = 1170
- TabIndex = 8
- Top = 0
- Width = 1200
- End
- Begin CommandButton cmdHelp
- Caption = "He&lp"
- Height = 540
- HelpContextID = 400
- Left = 1710
- TabIndex = 4
- Top = 1500
- Width = 1230
- End
- Begin CommandButton cmdExit
- Cancel = -1 'True
- Caption = "E&xit"
- Height = 540
- HelpContextID = 100
- Left = 1710
- TabIndex = 5
- Top = 2175
- Width = 1230
- End
- Begin CommandButton cmdPreferences
- Caption = "P&references"
- Height = 540
- HelpContextID = 300
- Left = 1710
- TabIndex = 3
- Top = 825
- Width = 1230
- End
- Begin CommandButton cmdRepair
- Caption = "Rep&air"
- Height = 540
- HelpContextID = 100
- Left = 270
- TabIndex = 2
- Top = 2175
- Width = 1230
- End
- Begin CommandButton cmdPrint
- Caption = "&Print"
- Height = 540
- HelpContextID = 100
- Left = 270
- TabIndex = 1
- Top = 1500
- Width = 1230
- End
- Begin CommandButton cmdMaintain
- Caption = "&Maintain"
- Default = -1 'True
- Height = 540
- HelpContextID = 200
- Left = 270
- TabIndex = 0
- Top = 825
- Width = 1230
- End
- Begin Label lblTitle
- BackColor = &H00FFFFFF&
- BackStyle = 0 'Transparent
- Caption = "Video Library"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 18
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 435
- Left = 450
- TabIndex = 6
- Top = 225
- Width = 2340
- End
- Begin Menu mnuFile
- Caption = "&File"
- HelpContextID = 100
- Begin Menu mnuFileSelect
- Caption = "&Select"
- HelpContextID = 100
- Shortcut = +{F2}
- End
- Begin Menu mnuFileCopy
- Caption = "&Copy"
- HelpContextID = 100
- Shortcut = ^{F2}
- End
- Begin Menu mnuFileRepair
- Caption = "&Repair"
- HelpContextID = 100
- End
- Begin Menu mnuFileBar1
- Caption = "-"
- End
- Begin Menu mnuFilePrint
- Caption = "&Print"
- HelpContextID = 100
- End
- Begin Menu mnuFileBar2
- Caption = "-"
- End
- Begin Menu mnuFileExit
- Caption = "E&xit"
- HelpContextID = 100
- End
- End
- Begin Menu mnuEdit
- Caption = "&Edit"
- HelpContextID = 200
- Begin Menu mnuEditGenre
- Caption = "&Genre"
- HelpContextID = 200
- Shortcut = {F3}
- End
- Begin Menu mnuEditRating
- Caption = "&Rating"
- HelpContextID = 200
- Shortcut = {F4}
- End
- Begin Menu mnuEditVideo
- Caption = "&Video"
- HelpContextID = 200
- End
- End
- Begin Menu mnuOptions
- Caption = "&Options"
- HelpContextID = 300
- Begin Menu mnuOptionsPreferences
- Caption = "&Preferences"
- HelpContextID = 300
- Shortcut = {F5}
- End
- End
- Begin Menu mnuHelp
- Caption = "&Help"
- HelpContextID = 400
- Begin Menu mnuHelpContents
- Caption = "&Contents"
- HelpContextID = 400
- End
- Begin Menu mnuHelpMain
- Caption = "&Main"
- HelpContextID = 400
- End
- Begin Menu mnuHelpSearch
- Caption = "&Search"
- HelpContextID = 400
- Shortcut = +{F1}
- End
- Begin Menu mnuHelpUsing
- Caption = "&Using Help"
- HelpContextID = 400
- End
- Begin Menu mnuHelpAuthor
- Caption = "Au&thor"
- HelpContextID = 400
- Shortcut = +^{F1}
- End
- Begin Menu mnuHelpBar1
- Caption = "-"
- End
- Begin Menu mnuHelpAbout
- Caption = "&About"
- HelpContextID = 400
- Shortcut = ^{F1}
- End
- End
- ' Subsystem: Main
- ' Module: VidLib.Frm
- ' Date: 01/02/94
- ' Author: Richard Stauch
- ' Notes:
- ' This is the initial form the user sees when the program begins.
- Option Explicit
- DefInt A-Z
- Sub cmdExit_Click ()
- ' Call the Exit routine from the File menu.
- mnuFileExit_Click
- End Sub
- Sub cmdHelp_Click ()
- ' Call the Main routine from the Help menu.
- mnuHelpContents_Click
- End Sub
- Sub cmdMaintain_Click ()
- ' Call the Video routine from the Edit menu.
- mnuEditVideo_Click
- End Sub
- Sub cmdPreferences_Click ()
- ' Call the Preferences routine from the Options menu.
- mnuOptionsPreferences_Click
- End Sub
- Sub cmdPrint_Click ()
- ' Call the Print routine from the File menu.
- mnuFilePrint_Click
- End Sub
- Sub cmdRepair_Click ()
- ' Call the Repair routine from the File menu.
- mnuFileRepair_Click
- End Sub
- Sub Form_Load ()
- ' Load the initial Video Library form.
- Dim INIFile As Integer ' Pointer to Information file.
- Dim I As Integer ' Length of Windows directory string.
- Dim TempStr As String ' Temp for Information file data.
- Dim WinDir As String ' Windows directory, where INI file is.
- ' Set copy options.
- GenreCopy% = True
- RatingCopy% = True
- VideoCopy% = True
- ReplaceData% = True
- ' Set preference defaults.
- DefaultPath$ = CurDir$
- DefaultName$ = "VidLib.MDB"
- DefaultReport$ = "Short"
- DefaultOutput$ = "Window"
- ' If there's a problem with the INI file, these are the defaults.
- On Error GoTo NormalDefault
- ' Prepare variable space for the DLL routine.
- WinDir$ = String(255, 0)
- ' Get the Windows program directory.
- I% = GetWindowsDirectory(ByVal WinDir$, Len(WinDir$))
- ' The return variable I% has the length of the string in
- ' WinDir$. The rest of it's prepared length is wasted.
- ChDir Left$(WinDir$, I%)
- ' Set the Help File name.
- If Right$(CurDir$, 1) = "\" Then
- HelpName$ = CurDir$ & "VidLib.HLP" & Chr$(0)
- Else
- HelpName$ = CurDir$ & "\VidLib.HLP" & Chr$(0)
- End If
- ' Set the Application help file name.
- App.HelpFile = HelpName$
- ' Set the dialog box help file name.
- dlgOpen.HelpFile = HelpName$
- ' Now, open the INI file for input only.
- INIFile% = FreeFile ' Get the next file number from the system.
- Open "VidLib.INI" For Input As INIFile%
- Do Until EOF(INIFile%)
- ' Look up the preference settings.
- Line Input #INIFile%, TempStr$
- If TempStr$ = "[File]" Then
- ' This is the File section.
- For I% = 1 To 2
- Line Input #INIFile%, TempStr$
- If Left$(TempStr$, 5) = "Path=" Then
- ' This is the prefered Path.
- DefaultPath$ = Right$(TempStr$, Len(TempStr$) - 5)
- End If
- If Left$(TempStr$, 5) = "Name=" Then
- ' This is the prefered File name.
- DefaultName$ = Right$(TempStr$, Len(TempStr$) - 5)
- End If
- Next I% ' File section.
- End If ' "File"
- If TempStr$ = "[Print]" Then
- ' This is the Print section.
- For I% = 1 To 2
- Line Input #INIFile%, TempStr$
- If Left$(TempStr$, 7) = "Report=" Then
- ' This is the prefered report name.
- DefaultReport$ = Right$(TempStr$, Len(TempStr$) - 7)
- End If
- If Left$(TempStr$, 7) = "Output=" Then
- ' This is the prefered Output direction.
- DefaultOutput$ = Right$(TempStr$, Len(TempStr$) - 7)
- End If
- Next I% ' Print section.
- End If ' "Print"
- Loop ' EOF(INIFile%)
- ' Close the INI file.
- Close #INIFile%
- ' Set the current drive:\directory.
- ChDir DefaultPath$
- NormalDefault:
- ' Set the path\name of the main *.MDB file.
- PathName$ = SetPathString(DefaultName$)
- TempName$ = SetPathString("VidTmp.MDB")
- CopyName$ = PathName$
- Exit Sub
- End Sub
- Sub mnuEditGenre_Click ()
- ' Edit the Genre table.
- ' Define the table for the Generic form.
- Generic$ = "G"
- ' During the Form_Load event,
- ' the VidGen form will Show itself.
- Load VidGen
- End Sub
- Sub mnuEditRating_Click ()
- ' Edit the Rating table.
- ' Define the table for the Generic form.
- Generic$ = "R"
- ' During the Form_Load event,
- ' the VidGen form will Show itself.
- Load VidGen
- End Sub
- Sub mnuEditVideo_Click ()
- ' Edit the Video table.
- ' During the Form_Load event,
- ' the VidMaint form will Show itself.
- Load VidMaint
- End Sub
- Sub mnuFileCopy_Click ()
- ' Copy data from the current file to another.
- VidCopy.Show MODAL ' The MODAL form will not
- ' allow any other form in
- ' this application to accept
- ' input.
- End Sub
- Sub mnuFileExit_Click ()
- ' Remove the main Video Library window from the screen,
- ' and End the program. But first, quit the Help engine.
- Dim R As Integer
- R% = WinHelp(VidLib.hWnd, Chr$(0), HELP_QUIT, CLng(0))
- End
- End Sub
- Sub mnuFilePrint_Click ()
- ' Print the data, using the default form/output.
- If DefaultOutput$ = "Window" Then
- ' Output to a window. The user can select to
- ' send data to the printer at that time.
- rptPrint.Destination = 0
- ElseIf DefaultOutput$ = "Printer" Then
- ' Output to the printer.
- rptPrint.Destination = 1
- ElseIf DefaultOutput$ = "File" Then
- ' Output to a file.
- rptPrint.Destination = 2
- End If
- If DefaultReport$ = "Short" Then
- ' Output the Short report.
- rptPrint.ReportFileName = "Short.RPT"
- Else
- ' Output the Long report.
- rptPrint.ReportFileName = "Long.RPT"
- End If
- ' Generate the report.
- rptPrint.Action = 1
- End Sub
- Sub mnuFileRepair_Click ()
- ' Repair the database.
- If GenericCancelBox(MBC_REPAIRDATA) = False Then
- ' User pressed the OK button.
- Screen.MousePointer = HOURGLASS ' Indicate "Wait".
- ' Repair the database.
- RepairDatabase PathName$
- ' Remove any deleted records.
- CompactDatabase PathName$, TempName$
- ' If there's a problem, it's probably the BAK file is missing.
- On Error GoTo KillError
- ' Delete the backup (BAK) file.
- Kill CurDir$ + "VidLib.BAK"
- ' Let Windows handle the errors.
- On Error GoTo 0
- ' The original file is now the backup (BAK) file.
- Name PathName$ As SetPathString("VidLib.BAK")
- ' The repaired database is now the default file.
- Name TempName$ As PathName$
- Screen.MousePointer = DEFAULT ' Indicate "Continue".
- End If
- Exit Sub
- KillError:
- ' ".BAK" file doesn't exist.
- Resume Next
- End Sub
- Sub mnuFileSelect_Click ()
- ' Select the file to use as the default.
- Dim I As Integer, J As Integer, OK As Integer
- ' The SelectPath function gets user input, and validates it.
- OK% = SelectPath()
- If OK% Then
- ' The selected file and path are valid.
- I% = Len(PathName$) ' The length of the fully qualified file name.
- J% = Len(dlgOpen.Filetitle) ' The length of the simple file name.
- ' Set the default file name.
- DefaultName$ = Right$(PathName$, J%)
- ' Set the default path.
- DefaultPath$ = Left$(PathName$, I% - J%)
- If Len(DefaultPath$) > 3 Then
- ' Remove the trialing back-slash if necessary.
- DefaultPath$ = Left$(DefaultPath$, Len(DefaultPath$) - 1)
- End If
- ' Set the temporary file name for the Repair routine.
- TempName$ = SetPathString("VidTmp.MDB")
- ' Set the current drive and directory.
- ChDrive Left$(DefaultPath$, 2)
- ChDir DefaultPath$
- End If
- End Sub
- Sub mnuHelpAbout_Click ()
- ' Display the About dialog box.
- VidAbout.Show MODAL
- End Sub
- Sub mnuHelpAuthor_Click ()
- ' Display information about the Author of this application.
- Dim R As Integer
- R% = WinHelp(VidLib.hWnd, HelpName$, HELP_CONTEXT, CLng(VIDLIB_AUTHOR))
- End Sub
- Sub mnuHelpContents_Click ()
- ' Start the WinHelp engine with the Index topic.
- Dim R As Integer
- R% = WinHelp(VidLib.hWnd, HelpName$, HELP_INDEX, CLng(0))
- End Sub
- Sub mnuHelpMain_Click ()
- ' Display the first help topic in the Main help group.
- Dim R As Integer
- R% = WinHelp(VidLib.hWnd, HelpName$, HELP_CONTEXT, CLng(VIDLIB_MAIN))
- End Sub
- Sub mnuHelpSearch_Click ()
- ' Display the Search help topic in the Help file.
- Dim R As Integer
- R% = WinHelp(VidLib.hWnd, HelpName$, HELP_CONTEXT, CLng(VIDLIB_SEARCH))
- End Sub
- Sub mnuHelpUsing_Click ()
- ' Open the Windows help file with the Using topic.
- Dim R As Integer
- R% = WinHelp(VidLib.hWnd, Chr$(0), HELP_HELPONHELP, CLng(0))
- End Sub
- Sub mnuOptionsPreferences_Click ()
- ' Load the Preferences dialog box.
- ' The Form_Load event with Show itself.
- Load VidPref
- End Sub
-